package 力扣日常刷题.木22二月.第19天225;

import java.util.Arrays;

/**
 * @author 帅小伙
 * @date 2022/2/25
 * @description
 */
public class Demo150n个骰子的点数 {

    public double[] dicesProbability(int n) {
        double[] dp = new double[6];
        Arrays.fill(dp,1.0/6);


        for (int i = 2; i <= n; i++) {
            double[] temp = new double[5* i + 1];
            for (int j = 0; j < dp.length; j++) {
                for (int k = 0; k < 6; k++) {
                    temp[j+k] += dp[j] * 1.0/6;
                }
            }
            dp = temp;
        }
        return dp;
    }

}
